package com.feihao.zhou.demo1;

import java.util.HashSet;
import java.util.Iterator;

public class HashSetSavingStudent {
    public static void main(String[] args) {
        Student s1 = new Student(18,"张三");
        Student s2 = new Student(18,"张三");
        Student s3 = new Student(20,"小孩");
        Student s4 = new Student(25,"放放风");

        HashSet<Student> hashSet = new HashSet<>();
        hashSet.add(s1);
        hashSet.add(s2);
        hashSet.add(s3);
        hashSet.add(s4);

        Iterator<Student> iterator = hashSet.iterator();
        while(iterator.hasNext()){
            Student z = iterator.next();
            System.out.println(z);
        }
    }
}
